package com.ssn.state.game;

public class Secondary extends Level{
    Secondary(Level level){
        this.name = "熟练级";
        this.game = level.game;
        this.score = level.score;
    }

    @Override
    public void checkLevel(int score) {
        if (score >= 100){
            game.setLevel(new Final(this));
        }else if(score >= 70){
            game.setLevel(new Professional(this));
        }else if(score < 40){
            game.setLevel(new Primary(this));
        }
    }

    @Override
    public void win() {
        if (useDouble){
            this.score += 10 * 2;
        }else{
            this.score += 10;
        }
        checkLevel(this.score);
        System.out.println("现在积分为 ： " + this.score);
        System.out.println("现在等级为 ： " + this.game.getLevel().name);
        useDouble =false;
    }

    @Override
    public void loose() {
        this.score -= 6;
        checkLevel(this.score);
        System.out.println("现在积分为 ： " + this.score);
        System.out.println("现在等级为 ： " + this.game.getLevel().name);
    }

    @Override
    public void play() {
        System.out.println("熟练级play");
    }

    @Override
    public void doubleScore() {
        System.out.println("使用加倍功能！！");
        useDouble = true;
    }

    @Override
    public void changeCards() {
        System.out.println("熟练级无换牌特权");
    }

    @Override
    public void peekCards() {
        System.out.println("熟练级无偷看排功能");
    }
}
